import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)


const routes = [
  { path: "*", redirect: "/list" },
  {
    path: "/list",
    name: "页面列表",
    component: () => import("./views/list.vue"),
    meta: { title: "h5列表" },
  },
  {
    path: "/apply",
    name: "apply",
    component: () => import("./pages/apply/index.vue"),
    meta: { title: "九银.KING全球首发盛典预约报名表" },
  },
  {
    path: "/oneDayShare",
    name: "oneDayShare",
    component: () => import("./pages/GZH/oneDayShare.vue"),
    meta: { title: "九银超级分享试驾" },
  },
  {
    path: "/oneDayShareXjcx",
    name: "oneDayShareXjcx",
    component: () => import("./pages/GZH/oneDayShareXjcx.vue"),
    meta: { title: "九银超级分享试驾" },
  },
  {
    path: "/q",
    name: "q",
    component: () => import("./pages/QRverification/index.vue"),
    meta: { title: "九银.King · 入场券" },
  },

  {
    path: "/testDrive",
    name: "testDrive",
    component: () => import("./pages/GZH/testDrive.vue"),
    meta: { title: "抢啊,你倒是抢啊,九银锂电车不花钱也可以抢免单" },
  },
  {
    path: "/myPrize",
    name: "myPrize",
    component: () => import("./pages/GZH/myPrize.vue"),
    meta: { title: "我的奖品" },
  },
  {
    path: "/share",
    name: "share",
    component: () => import("./pages/GZH/share.vue"),
    meta: { title: "我为九银代言，我在现场免费试骑真的很棒！" },
  },
  {
    path: "/share1",
    name: "share1",
    component: () => import("./pages/GZH/share1.vue"),
    meta: { title: "我为九银代言，我在现场免费试骑真的很棒！" },
  },
  // {
  //   path: "/QRverification",
  //   name: "QRverification",
  //   component: () => import("./pages/QRverification/index.vue"),
  //   meta: { title: "九银.King · 入场券" }
  // },
  // 使用指南
  {
    path: "/operatingGuideindex",
    name: "operatingGuideindex",
    component: () => import("./pages/applet/operatingGuide/index.vue"),
    meta: { title: "使用指南" },
    children: [
      {
        path: "/operatingGuide",
        name: "operatingGuide",
        component: () =>
          import("./pages/applet/operatingGuide/operatingGuide.vue"),
        meta: { title: "使用指南" },
      },
      {
        path: "/chanping",
        name: "chanping",
        component: () => import("./pages/applet/operatingGuide/chanping.vue"),
        meta: { title: "产品指南" },
      },
      {
        path: "/bangding",
        name: "bangding",
        component: () => import("./pages/applet/operatingGuide/bangding.vue"),
        meta: { title: "绑定车辆" },
      },
      {
        path: "/baoxiuka",
        name: "baoxiuka",
        component: () => import("./pages/applet/operatingGuide/baoxiuka.vue"),
        meta: { title: "绑定保修卡" },
      },
      {
        path: "/baoyang",
        name: "baoyang",
        component: () => import("./pages/applet/operatingGuide/baoyang.vue"),
        meta: { title: "保养预约" },
      },
      {
        path: "/fujin",
        name: "fujin",
        component: () => import("./pages/applet/operatingGuide/fujin.vue"),
        meta: { title: "附近网点" },
      },
      {
        path: "/gongxiang",
        name: "gongxiang",
        component: () => import("./pages/applet/operatingGuide/gongxiang.vue"),
        meta: { title: "共享用车" },
      },
      {
        path: "/jiebang",
        name: "jiebang",
        component: () => import("./pages/applet/operatingGuide/jiebang.vue"),
        meta: { title: "解绑车辆" },
      },
      {
        path: "/jiuyuan",
        name: "jiuyuan",
        component: () => import("./pages/applet/operatingGuide/jiuyuan.vue"),
        meta: { title: "救援服务" },
      },
      {
        path: "/shiqie",
        name: "shiqie",
        component: () => import("./pages/applet/operatingGuide/shiqie.vue"),
        meta: { title: "失窃上报" },
      },
      {
        path: "/kongche",
        name: "kongche",
        component: () => import("./pages/applet/operatingGuide/kongche.vue"),
        meta: { title: "手机控车" },
      },
      {
        path: "/baoxiu",
        name: "baoxiu",
        component: () => import("./pages/applet/operatingGuide/baoxiu.vue"),
        meta: { title: "在线报修" },
      },
      {
        path: "/dianziweilan",
        name: "dianziweilan",
        component: () =>
          import("./pages/applet/operatingGuide/dianziweilan.vue"),
        meta: { title: "电子围栏" },
      },
      {
        path: "/carAlarm",
        name: "carAlarm",
        component: () => import("./pages/applet/operatingGuide/carAlarm.vue"),
        meta: { title: "车辆告警" },
      },
      {
        path: "/insurance",
        name: "insurance",
        component: () => import("./pages/applet/operatingGuide/insurance.vue"),
        meta: { title: "尊享服务" },
      },
      {
        path: "/flow",
        name: "flow",
        component: () => import("./pages/applet/operatingGuide/flow.vue"),
        meta: { title: "流量充值" },
      },
      {
        path: "/newKey",
        name: "newKey",
        component: () => import("./pages/applet/operatingGuide/newKey.vue"),
        meta: { title: "匹配新钥匙" },
      },
    ],
  },
  //KING.说明书
  {
    path: "/KINGindex",
    name: "KINGindex",
    component: () => import("./pages/applet/KING/index.vue"),
    meta: { title: "KING.说明书" },
    children: [
      {
        path: "/KING",
        name: "KING",
        component: () => import("./pages/applet/KING/king.vue"),
        meta: { title: "KING.说明书" },
      },
      // 1
      {
        path: "/jiegou",
        name: "jiegou",
        component: () => import("./pages/applet/KING/jiegou.vue"),
        meta: { title: "整车结构" },
      },
      {
        path: "/xingneng",
        name: "xingneng",
        component: () => import("./pages/applet/KING/xingneng.vue"),
        meta: { title: "技术参数及性能" },
      },
      {
        path: "/zhonggao",
        name: "zhonggao",
        component: () => import("./pages/applet/KING/zhonggao.vue"),
        meta: { title: "提示与忠告" },
      },
      {
        path: "/sanbao",
        name: "sanbao",
        component: () => import("./pages/applet/KING/sanbao.vue"),
        meta: { title: "三包说明" },
      },
      {
        path: "/chongdian",
        name: "chongdian",
        component: () => import("./pages/applet/KING/chongdian.vue"),
        meta: { title: "怎样充电" },
      },
      {
        path: "/kongzhiqi",
        name: "kongzhiqi",
        component: () => import("./pages/applet/KING/kongzhiqi.vue"),
        meta: { title: "电机和控制器的使用和维护" },
      },
      {
        path: "/anquan",
        name: "anquan",
        component: () => import("./pages/applet/KING/anquan.vue"),
        meta: { title: "安全使用事项" },
      },
      {
        path: "/jiashi",
        name: "jiashi",
        component: () => import("./pages/applet/KING/jiashi.vue"),
        meta: { title: "驾驶操作" },
      },
      {
        path: "/baoyang1",
        name: "baoyang1",
        component: () => import("./pages/applet/KING/baoyang1.vue"),
        meta: { title: "调整与保养" },
      },
      {
        path: "/pachaguzhang",
        name: "pachaguzhang",
        component: () => import("./pages/applet/KING/pachaguzhang.vue"),
        meta: { title: "故障现象与排除" },
      },
      {
        path: "/shouhou",
        name: "shouhou",
        component: () => import("./pages/applet/KING/shouhou.vue"),
        meta: { title: "售后服务及三包明细表" },
      },
      {
        path: "/dianqitu",
        name: "dianqitu",
        component: () => import("./pages/applet/KING/dianqitu.vue"),
        meta: { title: "TDT111Z 电气原理图" },
      },
    ],
  },
  // K3.说明书
  {
    path: "/K3index",
    name: "K3index",
    component: () => import("./pages/applet/K3/index.vue"),
    meta: { title: "K3.说明书" },
    children: [
      {
        path: "/K3",
        name: "K3",
        component: () => import("./pages/applet/K3/k3.vue"),
        meta: { title: "K3.说明书" },
      },
      // 1
      {
        path: "/k3-jiegou",
        name: "k3-jiegou",
        component: () => import("./pages/applet/K3/k3-jiegou.vue"),
        meta: { title: "整车结构" },
      },
      {
        path: "/k3-xingneng",
        name: "k3-xingneng",
        component: () => import("./pages/applet/K3/k3-xingneng.vue"),
        meta: { title: "重要提示与忠告" },
      },
      {
        path: "/k3-sanbao",
        name: "k3-sanbao",
        component: () => import("./pages/applet/K3/k3-sanbao.vue"),
        meta: { title: "电池的使用、保养及三包说明" },
      },
      {
        path: "/k3-chongdian",
        name: "k3-chongdian",
        component: () => import("./pages/applet/K3/k3-chongdian.vue"),
        meta: { title: "怎样充电" },
      },
      {
        path: "/k3-kongzhiqi",
        name: "k3-kongzhiqi",
        component: () => import("./pages/applet/K3/k3-kongzhiqi.vue"),
        meta: { title: "电机和控制器的使用和维护" },
      },
      {
        path: "/k3-anquan",
        name: "k3-anquan",
        component: () => import("./pages/applet/K3/k3-anquan.vue"),
        meta: { title: "安全使用事项" },
      },
      {
        path: "/k3-jiashi",
        name: "k3-jiashi",
        component: () => import("./pages/applet/K3/k3-jiashi.vue"),
        meta: { title: "驾驶操作" },
      },
      {
        path: "/k3-baoyang1",
        name: "k3-baoyang1",
        component: () => import("./pages/applet/K3/k3-baoyang.vue"),
        meta: { title: "调整与保养" },
      },
      {
        path: "/k3-pachaguzhang",
        name: "k3-pachaguzhang",
        component: () => import("./pages/applet/K3/k3-pachaguzhang.vue"),
        meta: { title: "故障现象与排除" },
      },
      {
        path: "/k3-shouhou",
        name: "k3-shouhou",
        component: () => import("./pages/applet/K3/k3-shouhou.vue"),
        meta: { title: "售后服务及三包明细表" },
      },
      {
        path: "/k3-dianqitu",
        name: "k3-dianqitu",
        component: () => import("./pages/applet/K3/k3-dianqitu.vue"),
        meta: { title: "TDT111Z 电气原理图" },
      },
    ],
  },
  // G3.说明书
  {
    path: "/G3index",
    name: "G3index",
    component: () => import("./pages/applet/G3/index.vue"),
    meta: { title: "G3.说明书" },
    children: [
      {
        path: "/G3",
        name: "G3",
        component: () => import("./pages/applet/G3/G3.vue"),
        meta: { title: "G3.说明书" },
      },
      {
        path: "/G3-xuzhi",
        name: "G3-xuzhi",
        component: () => import("./pages/applet/G3/G3-xuzhi.vue"),
        meta: { title: "使用须知" },
      },
      {
        path: "/G3-waixing",
        name: "G3-waixing",
        component: () => import("./pages/applet/G3/G3-waixing.vue"),
        meta: { title: "外观及各部分名称" },
      },
      {
        path: "/G3-jiegou",
        name: "G3-jiegou",
        component: () => import("./pages/applet/G3/G3-jiegou.vue"),
        meta: { title: "结构性能主要技术参数表" },
      },
      {
        path: "/G3-chaozuo",
        name: "G3-chaozuo",
        component: () => import("./pages/applet/G3/G3-chaozuo.vue"),
        meta: { title: "操作，调整，维护与保养" },
      },
      {
        path: "/G3-shiyong",
        name: "G3-shiyong",
        component: () => import("./pages/applet/G3/G3-shiyong.vue"),
        meta: { title: "使用方法" },
      },
      {
        path: "/G3-sanbao",
        name: "G3-sanbao",
        component: () => import("./pages/applet/G3/G3-sanbao.vue"),
        meta: { title: "三包" },
      },
    ],
  },
  // G5.说明书
  {
    path: "/G5index",
    name: "G5index",
    component: () => import("./pages/applet/G5/index.vue"),
    meta: { title: "G5.说明书" },
    children: [
      {
        path: "/G5",
        name: "G5",
        component: () => import("./pages/applet/G5/G5.vue"),
        meta: { title: "G5.说明书" },
      },
      {
        path: "/G5-xuzhi",
        name: "G5-xuzhi",
        component: () => import("./pages/applet/G5/G5-xuzhi.vue"),
        meta: { title: "使用须知" },
      },
      {
        path: "/G5-waixing",
        name: "G5-waixing",
        component: () => import("./pages/applet/G5/G5-waixing.vue"),
        meta: { title: "外观及各部分名称" },
      },
      {
        path: "/G5-jiegou",
        name: "G5-jiegou",
        component: () => import("./pages/applet/G5/G5-jiegou.vue"),
        meta: { title: "结构性能主要技术参数表" },
      },
      {
        path: "/G5-chaozuo",
        name: "G5-chaozuo",
        component: () => import("./pages/applet/G5/G5-chaozuo.vue"),
        meta: { title: "操作，调整，维护与保养" },
      },
      {
        path: "/G5-shiyong",
        name: "G5-shiyong",
        component: () => import("./pages/applet/G5/G5-shiyong.vue"),
        meta: { title: "使用方法" },
      },
      {
        path: "/G5-sanbao",
        name: "G5-sanbao",
        component: () => import("./pages/applet/G5/G5-sanbao.vue"),
        meta: { title: "三包" },
      },
    ],
  },
  // GT.说明书
  {
    path: "/GTindex",
    name: "GTindex",
    component: () => import("./pages/applet/GT/index.vue"),
    meta: { title: "GT.说明书" },
    children: [
      {
        path: "/GT",
        name: "GT",
        component: () => import("./pages/applet/GT/GT.vue"),
        meta: { title: "GT.说明书" },
      },
      {
        path: "/GT-xuzhi",
        name: "GT-xuzhi",
        component: () => import("./pages/applet/GT/GT-xuzhi.vue"),
        meta: { title: "使用须知" },
      },
      {
        path: "/GT-waixing",
        name: "GT-waixing",
        component: () => import("./pages/applet/GT/GT-waixing.vue"),
        meta: { title: "外观及各部分名称" },
      },
      {
        path: "/GT-jiegou",
        name: "GT-jiegou",
        component: () => import("./pages/applet/GT/GT-jiegou.vue"),
        meta: { title: "结构性能主要技术参数表" },
      },
      {
        path: "/GT-chaozuo",
        name: "GT-chaozuo",
        component: () => import("./pages/applet/GT/GT-chaozuo.vue"),
        meta: { title: "操作，调整，维护与保养" },
      },
      {
        path: "/GT-shiyong",
        name: "GT-shiyong",
        component: () => import("./pages/applet/GT/GT-shiyong.vue"),
        meta: { title: "使用方法" },
      },
      {
        path: "/GT-sanbao",
        name: "GT-sanbao",
        component: () => import("./pages/applet/GT/GT-sanbao.vue"),
        meta: { title: "三包" },
      },
    ],
  },
  // 常见问题
  {
    path: "/issueIndex",
    name: "issueIndex",
    component: () => import("./pages/applet/issue/index.vue"),
    meta: { title: "常见问题" },
    children: [
      {
        path: "/issue",
        name: "issue",
        component: () => import("./pages/applet/issue/issue.vue"),
        meta: { title: "常见问题" },
      },
      {
        path: "/waiguan",
        name: "waiguan",
        component: () => import("./pages/applet/issue/waiguan.vue"),
        meta: { title: "外观目录" },
      },
      {
        path: "/shache",
        name: "shache",
        component: () => import("./pages/applet/issue/shache.vue"),
        meta: { title: "刹车系统" },
      },
      {
        path: "/cheti",
        name: "cheti",
        component: () => import("./pages/applet/issue/cheti.vue"),
        meta: { title: "车体部件" },
      },
      {
        path: "/yixiang",
        name: "yixiang",
        component: () => import("./pages/applet/issue/yixiang.vue"),
        meta: { title: "异响" },
      },
      {
        path: "/dianchi",
        name: "dianchi",
        component: () => import("./pages/applet/issue/dianchi.vue"),
        meta: { title: "电池" },
      },
      {
        path: "/chongdian1",
        name: "chongdian1",
        component: () => import("./pages/applet/issue/chongdian.vue"),
        meta: { title: "充电器" },
      },
      {
        path: "/dianqi",
        name: "dianqi",
        component: () => import("./pages/applet/issue/dianqi.vue"),
        meta: { title: "电器系统" },
      },
      {
        path: "/yaoshi",
        name: "yaoshi",
        component: () => import("./pages/applet/issue/yaoshi.vue"),
        meta: { title: "钥匙" },
      },
      {
        path: "/guzhang",
        name: "guzhang",
        component: () => import("./pages/applet/issue/guzhang.vue"),
        meta: { title: "" },
      },
    ],
  },
];

routes.forEach(route => {
  route.path = route.path || "/" + (route.name || "");
});

const router = new Router({
  // mode: "history",l
  // base: process.env.BASE_URL,
  routes: routes
});

router.beforeEach((to, from, next) => {
  // console.log(to, from, next);
  const title = to.meta && to.meta.title;
  if (title) {
    document.title = title;
  }
  next();
});

export default router